package models

import "gorm.io/gorm"

// 订单表

type Order struct {
	gorm.Model
	UserID    int64   `gorm:"int(10)" json:"user_id"`
	OrderSn   string  `gorm:"type:varchar(255);not null" json:"order_sn"`
	Total     float64 `gorm:"type:decimal(10,2);not null" json:"total"`
	AddressID int64   `gorm:"int(10)" json:"address_id"`
	Status    int64   `gorm:"type:int(10);not null" json:"status"`   //1:待支付 2:已支付 3.待发货
	PayType   int     `gorm:"type:int(10);not null" json:"pay_type"` //1.微信支付 2.支付宝支付 3.支付
}

// 订单明细表

type OrdersItem struct {
	gorm.Model
	OrderID    int64   `gorm:"int(10)" json:"order_id"`
	GoodsID    int64   `gorm:"int(10)" json:"goods_id"`
	GoodsName  string  `gorm:"type:varchar(255);not null" json:"goods_name"`
	GoodsPrice float64 `gorm:"type:decimal(10,2);not null" json:"goods_price"`
	GoodsImg   string  `gorm:"type:varchar(255);not null" json:"goods_img"`
	Quantity   int64   `gorm:"int(10)" json:"quantity"`
	Subtotal   float64 `gorm:"type:decimal(10,2);not null" json:"subtotal"`
}
